
/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package Apusic.impl;

import Apusic.ApusicPackage;
import Apusic.EJBCfg;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import javax.management.ObjectName;
import org.eclipse.emf.ecore.EObject;
import com.apusic.admin.config.*;
import com.apusic.admin.*;

import cn.edu.pku.sei.ra.wrapping.CommonWrapping.WrappingEObject;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.impl.WrappingEObjectImpl;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.EObjectContainmentEListForWrapping;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.EObjectResolvingEListForWrapping;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.ImagePool;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>EJB Cfg</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link Apusic.impl.EJBCfgImpl#getDefaultEntityPersistenceDataSource <em>Default Entity Persistence Data Source</em>}</li>
 *   <li>{@link Apusic.impl.EJBCfgImpl#getDefaultMessageDrivenConnectionFactory <em>Default Message Driven Connection Factory</em>}</li>
 *   <li>{@link Apusic.impl.EJBCfgImpl#getSessionStoreDirectory <em>Session Store Directory</em>}</li>
 *   <li>{@link Apusic.impl.EJBCfgImpl#getEntityCacheSize <em>Entity Cache Size</em>}</li>
 *   <li>{@link Apusic.impl.EJBCfgImpl#getSessionCacheSize <em>Session Cache Size</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EJBCfgImpl extends WrappingEObjectImpl implements EJBCfg
{
  /**
   * The default value of the '{@link #getDefaultEntityPersistenceDataSource() <em>Default Entity Persistence Data Source</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDefaultEntityPersistenceDataSource()
   * @generated
   * @ordered
   */
  protected static final String DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDefaultEntityPersistenceDataSource() <em>Default Entity Persistence Data Source</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDefaultEntityPersistenceDataSource()
   * @generated
   * @ordered
   */
  protected String defaultEntityPersistenceDataSource = DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE_EDEFAULT;

  /**
   * The default value of the '{@link #getDefaultMessageDrivenConnectionFactory() <em>Default Message Driven Connection Factory</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDefaultMessageDrivenConnectionFactory()
   * @generated
   * @ordered
   */
  protected static final String DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDefaultMessageDrivenConnectionFactory() <em>Default Message Driven Connection Factory</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDefaultMessageDrivenConnectionFactory()
   * @generated
   * @ordered
   */
  protected String defaultMessageDrivenConnectionFactory = DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY_EDEFAULT;

  /**
   * The default value of the '{@link #getSessionStoreDirectory() <em>Session Store Directory</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSessionStoreDirectory()
   * @generated
   * @ordered
   */
  protected static final String SESSION_STORE_DIRECTORY_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getSessionStoreDirectory() <em>Session Store Directory</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSessionStoreDirectory()
   * @generated
   * @ordered
   */
  protected String sessionStoreDirectory = SESSION_STORE_DIRECTORY_EDEFAULT;

  /**
   * The default value of the '{@link #getEntityCacheSize() <em>Entity Cache Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEntityCacheSize()
   * @generated
   * @ordered
   */
  protected static final int ENTITY_CACHE_SIZE_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getEntityCacheSize() <em>Entity Cache Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEntityCacheSize()
   * @generated
   * @ordered
   */
  protected int entityCacheSize = ENTITY_CACHE_SIZE_EDEFAULT;

  /**
   * The default value of the '{@link #getSessionCacheSize() <em>Session Cache Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSessionCacheSize()
   * @generated
   * @ordered
   */
  protected static final int SESSION_CACHE_SIZE_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getSessionCacheSize() <em>Session Cache Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSessionCacheSize()
   * @generated
   * @ordered
   */
  protected int sessionCacheSize = SESSION_CACHE_SIZE_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected EJBCfgImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ApusicPackage.Literals.EJB_CFG;
  }

  
  

  
  
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
   public boolean isForCore(Object arg0){
   	boolean result=true;
   	if(core==null) return false;
    try{
    result=true;
    }
    catch(Exception e){
      result=false;
    }
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
  public List listSubCores(int featureID){
    List result=new ArrayList();
  
    EJBConfig core=(EJBConfig)this.getCore();
    if(core==null) 
      return result;
    switch(featureID){
    
  
  
  
  
  
  }
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
  public EClass getChildClassMap(Object object){
    ApusicPackage pack=ApusicPackage.eINSTANCE;	
  
  
  
  
  
  
    return null;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDefaultEntityPersistenceDataSource()
  {
        Object result=null;
        EJBConfig core=(EJBConfig)getCore();
        if(core==null) return defaultEntityPersistenceDataSource;	
        try
{
defaultEntityPersistenceDataSource=core.getDefaultEntityPersistenceDataSource();
}
catch(Exception e)
{
  defaultEntityPersistenceDataSource = null;
}
    return defaultEntityPersistenceDataSource; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDefaultEntityPersistenceDataSource(String newDefaultEntityPersistenceDataSource)
  {
    String oldDefaultEntityPersistenceDataSource = defaultEntityPersistenceDataSource;
    defaultEntityPersistenceDataSource = newDefaultEntityPersistenceDataSource;
        	
      EJBConfig core=(EJBConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.EJB_CFG__DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE, oldDefaultEntityPersistenceDataSource, defaultEntityPersistenceDataSource));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDefaultMessageDrivenConnectionFactory()
  {
        Object result=null;
        EJBConfig core=(EJBConfig)getCore();
        if(core==null) return defaultMessageDrivenConnectionFactory;	
        try
{
defaultMessageDrivenConnectionFactory=core.getDefaultMessageDrivenConnectionFactory();
}
catch(Exception e)
{
  defaultMessageDrivenConnectionFactory = null;
}
    return defaultMessageDrivenConnectionFactory; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDefaultMessageDrivenConnectionFactory(String newDefaultMessageDrivenConnectionFactory)
  {
    String oldDefaultMessageDrivenConnectionFactory = defaultMessageDrivenConnectionFactory;
    defaultMessageDrivenConnectionFactory = newDefaultMessageDrivenConnectionFactory;
        	
      EJBConfig core=(EJBConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.EJB_CFG__DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY, oldDefaultMessageDrivenConnectionFactory, defaultMessageDrivenConnectionFactory));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getSessionStoreDirectory()
  {
        Object result=null;
        EJBConfig core=(EJBConfig)getCore();
        if(core==null) return sessionStoreDirectory;	
        try
{
sessionStoreDirectory=core.getSessionStoreDirectory();
}
catch(Exception e)
{
  sessionStoreDirectory = null;
}
    return sessionStoreDirectory; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSessionStoreDirectory(String newSessionStoreDirectory)
  {
    String oldSessionStoreDirectory = sessionStoreDirectory;
    sessionStoreDirectory = newSessionStoreDirectory;
        	
      EJBConfig core=(EJBConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.EJB_CFG__SESSION_STORE_DIRECTORY, oldSessionStoreDirectory, sessionStoreDirectory));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getEntityCacheSize()
  {
        Object result=null;
        EJBConfig core=(EJBConfig)getCore();
        if(core==null) return entityCacheSize;	
        try
{
entityCacheSize=core.getEntityCacheSize();
}
catch(Exception e)
{
  entityCacheSize = -1;
}
    return entityCacheSize; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEntityCacheSize(int newEntityCacheSize)
  {
    int oldEntityCacheSize = entityCacheSize;
    entityCacheSize = newEntityCacheSize;
        	
      EJBConfig core=(EJBConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.EJB_CFG__ENTITY_CACHE_SIZE, oldEntityCacheSize, entityCacheSize));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getSessionCacheSize()
  {
        Object result=null;
        EJBConfig core=(EJBConfig)getCore();
        if(core==null) return sessionCacheSize;	
        try
{
sessionCacheSize=core.getEntityCacheSize();
}
catch(Exception e)
{
  sessionCacheSize = -1;
}
    return sessionCacheSize; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSessionCacheSize(int newSessionCacheSize)
  {
    int oldSessionCacheSize = sessionCacheSize;
    sessionCacheSize = newSessionCacheSize;
        	
      EJBConfig core=(EJBConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.EJB_CFG__SESSION_CACHE_SIZE, oldSessionCacheSize, sessionCacheSize));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ApusicPackage.EJB_CFG__DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE:
        return getDefaultEntityPersistenceDataSource();
      case ApusicPackage.EJB_CFG__DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY:
        return getDefaultMessageDrivenConnectionFactory();
      case ApusicPackage.EJB_CFG__SESSION_STORE_DIRECTORY:
        return getSessionStoreDirectory();
      case ApusicPackage.EJB_CFG__ENTITY_CACHE_SIZE:
        return new Integer(getEntityCacheSize());
      case ApusicPackage.EJB_CFG__SESSION_CACHE_SIZE:
        return new Integer(getSessionCacheSize());
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ApusicPackage.EJB_CFG__DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE:
        setDefaultEntityPersistenceDataSource((String)newValue);
        return;
      case ApusicPackage.EJB_CFG__DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY:
        setDefaultMessageDrivenConnectionFactory((String)newValue);
        return;
      case ApusicPackage.EJB_CFG__SESSION_STORE_DIRECTORY:
        setSessionStoreDirectory((String)newValue);
        return;
      case ApusicPackage.EJB_CFG__ENTITY_CACHE_SIZE:
        setEntityCacheSize(((Integer)newValue).intValue());
        return;
      case ApusicPackage.EJB_CFG__SESSION_CACHE_SIZE:
        setSessionCacheSize(((Integer)newValue).intValue());
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ApusicPackage.EJB_CFG__DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE:
        setDefaultEntityPersistenceDataSource(DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE_EDEFAULT);
        return;
      case ApusicPackage.EJB_CFG__DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY:
        setDefaultMessageDrivenConnectionFactory(DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY_EDEFAULT);
        return;
      case ApusicPackage.EJB_CFG__SESSION_STORE_DIRECTORY:
        setSessionStoreDirectory(SESSION_STORE_DIRECTORY_EDEFAULT);
        return;
      case ApusicPackage.EJB_CFG__ENTITY_CACHE_SIZE:
        setEntityCacheSize(ENTITY_CACHE_SIZE_EDEFAULT);
        return;
      case ApusicPackage.EJB_CFG__SESSION_CACHE_SIZE:
        setSessionCacheSize(SESSION_CACHE_SIZE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ApusicPackage.EJB_CFG__DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE:
        return DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE_EDEFAULT == null ? defaultEntityPersistenceDataSource != null : !DEFAULT_ENTITY_PERSISTENCE_DATA_SOURCE_EDEFAULT.equals(defaultEntityPersistenceDataSource);
      case ApusicPackage.EJB_CFG__DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY:
        return DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY_EDEFAULT == null ? defaultMessageDrivenConnectionFactory != null : !DEFAULT_MESSAGE_DRIVEN_CONNECTION_FACTORY_EDEFAULT.equals(defaultMessageDrivenConnectionFactory);
      case ApusicPackage.EJB_CFG__SESSION_STORE_DIRECTORY:
        return SESSION_STORE_DIRECTORY_EDEFAULT == null ? sessionStoreDirectory != null : !SESSION_STORE_DIRECTORY_EDEFAULT.equals(sessionStoreDirectory);
      case ApusicPackage.EJB_CFG__ENTITY_CACHE_SIZE:
        return entityCacheSize != ENTITY_CACHE_SIZE_EDEFAULT;
      case ApusicPackage.EJB_CFG__SESSION_CACHE_SIZE:
        return sessionCacheSize != SESSION_CACHE_SIZE_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (defaultEntityPersistenceDataSource: ");
    result.append(defaultEntityPersistenceDataSource);
    result.append(", defaultMessageDrivenConnectionFactory: ");
    result.append(defaultMessageDrivenConnectionFactory);
    result.append(", sessionStoreDirectory: ");
    result.append(sessionStoreDirectory);
    result.append(", entityCacheSize: ");
    result.append(entityCacheSize);
    result.append(", sessionCacheSize: ");
    result.append(sessionCacheSize);
    result.append(')');
    return result.toString();
  }

} //EJBCfgImpl
